#include <iostream>
#include <unordered_set>
#include <cstring>
#include <algorithm>

using namespace std;
int n;
unordered_set<char> s;
char id, request[100];

int main()
{
    while (cin >> n)
    {
        s.clear();
        std::size_t ret = 0;
        while (n--)
        {
            getchar();
            scanf("%c %s", &id, request);
            if (strcmp("connect", request) == 0)
            {
                s.insert(id);
            }
            else
            {
                s.erase(id);
            }
            ret = max(ret, s.size());
        }
        cout << ret << endl;
    }
    return 0;
}
